//
//  DHS2_CouponsCell.m
//  Dresshere
//
//  Created by ZhangPeng on 2018/6/10.
//  Copyright © 2018年 张朋. All rights reserved.
//

#import "DHS2_CouponsCell.h"

@implementation DHS2_CouponsCell

- (void)awakeFromNib {
    [super awakeFromNib];
    
    self.outView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.3];
    self.outView.hidden = YES;
}

- (void)updateCell:(NSDictionary *)dic{
    self.nameLabel.text = [dic objectForKey:@"name"];
    
    NSDate *date = [NSDate dateWithServerISOString:[dic objectForKey:@"expire"] format:@"yyyy-MM-dd'T'HH:mm:ss.SSSZ"];
    self.timeLabel.text = [NSString stringWithFormat:@"有效期至%@",[NSDate stringFromDate:date withFormat:@"yyyy/MM/dd"]];
    self.titleLabel.text = [dic objectForKey:@"type"];
    
    self.mainColor.backgroundColor = [UIColor colorWithHexString:[dic objectForKey:@"color"]];
    
    if ([[dic objectForKey:@"used"] boolValue]) {
        self.outView.hidden = NO;
    }else{
        self.outView.hidden = YES;
    }
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
